home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2009 February / PCWFEB09.iso / Software / Linux / SLAX 6.0.8 / slax-6.0.8.iso / slax / base / 006-devel.lzm / usr / include / k3bdiskinfo.h < prev    next >
Encoding:
C/C++ Source or Header  |  2008-05-27  |  4.6 KB  |  183 lines

  1. /*
  2.  *
  3.  * $Id: k3bdiskinfo.h 619556 2007-01-03 17:38:12Z trueg $
  4.  * Copyright (C) 2003-2007 Sebastian Trueg <trueg@k3b.org>
  5.  *
  6.  * This file is part of the K3b project.
  7.  * Copyright (C) 1998-2007 Sebastian Trueg <trueg@k3b.org>
  8.  *
  9.  * This program is free software; you can redistribute it and/or modify
  10.  * it under the terms of the GNU General Public License as published by
  11.  * the Free Software Foundation; either version 2 of the License, or
  12.  * (at your option) any later version.
  13.  * See the file "COPYING" for the exact licensing terms.
  14.  */
  15.  
  16.  
  17. #ifndef _K3B_DISKINFO_H_
  18. #define _K3B_DISKINFO_H_
  19.  
  20. #include <k3bdevicetypes.h>
  21.  
  22. #include <k3btoc.h>
  23. #include <k3bmsf.h>
  24. #include "k3bdevice_export.h"
  25.  
  26. #include <qcstring.h>
  27.  
  28.  
  29. class kdbgstream;
  30.  
  31.  
  32. namespace K3bDevice
  33. {
  34.   /**
  35.    * This class is directly accociated to a strcuture from 
  36.    * the MMC draft READ_DISK_INFO.
  37.    * It also holds some additional data.
  38.    * This class' data will be retrieved by K3bDevice::Device.
  39.    *
  40.    * Before using any values one should check diskState != STATE_UNKNOWN or
  41.    * diskState == STATE_NO_MEDIA.
  42.    * That may mean that no disk is in the drive or an error occurred.
  43.    * Writers should never give the STATE_UNKNOWN state. CD-ROM or DVD-ROM
  44.    * drives on the other hand may have trouble determining the state of the disk.
  45.    */
  46.   class LIBK3BDEVICE_EXPORT DiskInfo
  47.     {
  48.     public:
  49.       DiskInfo();
  50.       ~DiskInfo();
  51.  
  52.       /**
  53.        * Returnes the state of the disk.
  54.        * See enum State.
  55.        */
  56.       int diskState() const;
  57.  
  58.       /**
  59.        * Returnes the state of the last session.
  60.        * See enum State.
  61.        */
  62.       int lastSessionState() const;
  63.  
  64.       /**
  65.        * Returnes the state of the background formatting. This does
  66.        * only make sense for DVD+RW (and MRW which is not yet supported)
  67.        */
  68.       int bgFormatState() const;
  69.  
  70.       /**
  71.        * returnes true if diskState() == STATE_EMPTY
  72.        */
  73.       bool empty() const;
  74.  
  75.       /**
  76.        * Is this a rewritable media (e.g. a CD-RW, DVD-RW, or DVD+RW)
  77.        */
  78.       bool rewritable() const;
  79.  
  80.       /**
  81.        * Is this disk appendable
  82.        * returnes true if diskState() == STATE_INCOMPLETE
  83.        */
  84.       bool appendable() const;
  85.  
  86.       /**
  87.        * The type of the disk:
  88.        * CD-ROM, CD-R, CD-RW, DVD-ROM, DVD-R(W), DVD+R(W)
  89.        */
  90.       int mediaType() const;
  91.  
  92.       /**
  93.        * This is the current profile of the drive. That means it may differ
  94.        * from drive to drive.
  95.        * -1 means no info.
  96.        * Mainly interesting for the distiction of DVD-R(W) modes:
  97.        * Sequential and Restricted Overwrite.
  98.        */
  99.       int currentProfile() const { return m_currentProfile; }
  100.  
  101.       /**
  102.        * Just for easy implementation since there are so many
  103.        * different DVD formats.
  104.        */
  105.       bool isDvdMedia() const;
  106.  
  107.       /**
  108.        * The number of sessions on the disk.
  109.        * This does not include any leadout or the last empty session
  110.        * on a DVD+-R(W)
  111.        */
  112.       int numSessions() const;
  113.  
  114.       /**
  115.        * The number of finished tracks.
  116.        * This does not include the empty track.
  117.        */
  118.       int numTracks() const;
  119.  
  120.       /**
  121.        * Number of layers on a DVD media. For CD media this is always 1.
  122.        */
  123.       int numLayers() const;
  124.  
  125.       /**
  126.        * Does only make sense for appendable disks.
  127.        */
  128.       K3b::Msf remainingSize() const;
  129.  
  130.       /**
  131.        * The capacity of the disk.
  132.        * For complete disks this may be the same as size()
  133.        */
  134.       K3b::Msf capacity() const;
  135.  
  136.       /**
  137.        * Returns the size of the used part.
  138.        * For appendable media this equals capacity() - remainingSize()
  139.        */
  140.       K3b::Msf size() const;
  141.  
  142.       /**
  143.        * Returns the size of Data area in the first layer for DL DVD media.
  144.        * Otherwise size() is returned.
  145.        *
  146.        * This does not specify the layer change sector as the data area on DVD media does
  147.        * not start at sector 0 but at sector 30000h or 31000h depending on the type.
  148.        */
  149.       K3b::Msf firstLayerSize() const;
  150.  
  151.       const QCString& mediaId() const { return m_mediaId; }
  152.  
  153.       void debug() const;
  154.  
  155.       bool operator==( const DiskInfo& ) const;
  156.       bool operator!=( const DiskInfo& ) const;
  157.  
  158.     private:
  159.       int m_mediaType;
  160.       int m_currentProfile;
  161.  
  162.       int m_diskState;
  163.       int m_lastSessionState;
  164.       int m_bgFormatState;
  165.       int m_numSessions;
  166.       int m_numTracks;
  167.       int m_numLayers;  // only for DVD media
  168.       int m_rewritable;
  169.  
  170.       K3b::Msf m_capacity;
  171.       K3b::Msf m_usedCapacity;
  172.       K3b::Msf m_firstLayerSize;
  173.  
  174.       QCString m_mediaId;
  175.  
  176.       friend class Device;
  177.     };
  178.  
  179.   //  kdbgstream& operator<<( kdbgstream& s, const DiskInfo& ngInf );
  180. }
  181.  
  182. #endif
  183.